Many electronic devices include one or more displays on which information can be provided to a user. For example, graphics, images, videos, text, glyphs, or other content can be provided on a display. The content can be disposed on the display in any suitable manner including, for example, as distinct, non-overlapping content, or as content disposed on different overlapping layers. Content can be provided from any suitable source including, for example, from an application provided on the electronic device, an operating system, firmware, or any other source for providing content to display. In some cases, a single source can provide several instances of content including, for example, instances of overlapping content (e.g., text in a drawn text box).
Content provided for display can be formatted using different approaches. In some cases, an application can define, for the content provided by the application, a manner in which different instances of content are to be displayed. Similarly, other sources of content (e.g., an operating system or firmware) can direct a manner in which particular instances of content provided by an application are to be displayed. When text is displayed in a particular region of a display, attributes corresponding to the particular text and to the particular region can be selected. For example, a particular font type and font size can be selected based on the size of the region, or on a characteristic of the region within a given displayed user interface (e.g., a level within a hierarchical menu).
To ensure that the displayed text is displayed properly, attributes defining the manner in which the text is to be displayed can be selected so that the text fits properly within a display region. In some cases, particular font types and font sizes can be selected so that text fits in the display region in a manner that maximizes the available display region. For example, font types and sizes can be selected such that an entire text string fills a single line of a region, and the single line extends across the entirety of the display region. As another example, a text string can be displayed such that the string extends, on two or more lines, across the entirety of the display region. In some embodiments, default attributes can instead or in addition be used for particular text.
The display attributes specifying the manner in which text is displayed can be provided using different approaches. For text provided by an application or an operating system, a programmer can code pre-established display attributes to associate with each instance of text. Other text, however, may instead be provided by a user, or identified from data stored on the device by a user, and may not be known to a programmer of an application or an operating system. For such text, the electronic device may be required to select attributes for displaying the text strings. While default attributes can be selected, this approach may not account for the size of a display region or for the amount of text to display, and may therefore cause the device to display text in a manner that is not aesthetically pleasing, or in a manner that detracts from a desired user experience.
Furthermore, some user interfaces can be designed for text in a particular language. In particular, display attributes, as well as display region sizes, can be selected based on known or expected text in a given language. If an end user wishes to use a different language, however, the text displayed may differ (e.g., the text can have a different length or include space between words at different positions within the text). In some languages, the text can be so different that simply using the display attributes associated with the corresponding text in the initial language can lead to a user interface that is not aesthetically pleasing (e.g., text in German may include longer words that do not fit in a display region when attributes corresponding to an English equivalent with shorter words are used).